from time import gmtime, strftime
import time
import timeit

from Strategy.config import CONFIG, STATIC

from MarketData.const import CONST
from MarketData.quote import Quote

from PlaceOrder.order import newOrder

from Strategy.model import evaluation, filter_Profit
from Strategy.order import create_newOrder
from Strategy.order import newOrder_thread, placeOrder_multithread
from Strategy.account import tieAccount_trade, tieAccount_withdraw, update_Account_fromOrder

from GUI.output import output_Array, output_MarketData, output_newOrder, output_Balance, PATH

#download market quote, try weather opportunity
def trade_pairs_try(platform, currency):
    #1. INPUT
    print("#1. INPUT")
    #1.1 parameter
    print("#1.1 parameter")

    #1.2market quote
    #(price_bid, volume_bid, price_ask, volume_ask)
    print("#1.2 market quote")

    pairquote = dict()
    for platf in platform:
        start = timeit.default_timer()

        pairquote[platf] = Quote(platf, currency[0], currency[1], 0)
        
        stop = timeit.default_timer()

        print(platf, stop - start)

    output_MarketData('C:/quant/' + currency[0] + currency[1] + '/marketData ' + strftime("%Y%m%d", gmtime()) + '.txt', platform, pairquote)
    return